💫 tryhard
tryhard
makes it easy to retry futures that might fail. You can control the number of retries, the backoff strategy, and the max duration.
Examples
First imagine you have some async function that can fail:
async
Calling that function and retrying at most 10 times with no delay between attempts can be done like so:
.retries
.await?;
retry_fn
You can also retry with a fixed delay between attempts:
.retries
.fixed_backoff
.await?;
retry_fn
Or exponential backoff, where the delay doubles each time, with a max delay of 1 second:
.retries
.exponential_backoff
.max_delay
.await?;
retry_fn
See the docs for more details.
Contributing
We welcome community contributions to this project.
Please read our Contributor Guide for more information on how to get started.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.